package site.marqstree.kotlin.library.base.ui.widget.search.activity.recyclerview

import android.app.Activity
import android.view.View
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.listener.OnItemClickListener
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import kotlinx.android.synthetic.main.activity_search.*
import site.marqstree.kotlin.library.base.ui.R
import site.marqstree.kotlin.library.base.ui.widget.search.activity.ActivitySearch


/*
 * 项目名: KotlinMall
 * 包名: site.marqstree.kotlin.library.base.ui.widget.search.activity.recyclerview
 * 文件名: SearchHistoryAdapter
 * 创建者: marqstree
 * 创建时间: 2020/3/9 16:38
 * 描述: TODO
 */
class SearchHistoryAdapter(val mList: MutableList<String>): BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_search_history,mList),
    OnItemClickListener {

    init {
        setOnItemClickListener(this)
    }

    override fun convert(helper: BaseViewHolder, item: String) {
        helper.setText(R.id.mhistoryItemTv,item)
    }

    override fun onItemClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) {
        (context as ActivitySearch).mKeywordEt.setText(data.get(position))
    }
}